<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'test.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>
  
  <body>
    用户列表显示
    <table  border="1px" bordercolor="blue">
    	<c:forEach  items="${users }"  var="u" varStatus="uv">
    	<tr>
    	<td>${uv.count }</td>
    	<td>${u.uname}</td>
    	<td>${ u.relname}</td>
    	<td>${ u.rname}</td>
    	<td>${u.department.oname}/${u.department.dname }</td>
    	<td><c:if   test="${u.sex==0 }">男</c:if><c:if   test="${u.sex==1 }">女</c:if></td>
    	<td>
    	<c:if   test="${u.state==0 }">正常</c:if>
    	<c:if   test="${u.state==1}">冻结</c:if>
    	</td>
    	<td>图片路径${u.src }</td>
    	<td>权限ID${u.rid }</td>
    	<td><a  href="QueryUser.action?uid=${u.uid }">修改</a></td>
    	</tr>
    	</c:forEach>
    </table>
    
    <form action="UpdateUser.action"  method="post">
    <a  href="DelUser.action?uid=${user.uid }">删除</a>
    用户详情修改：<br/>
    <input  type="hidden"   value="${user.uid }"   name="user.uid"/>
    登录名：<input  type="text"  name="user.uname"  value="${user.uname }"/><br/>
    密码：<input  type="text"  name="user.password"  value="${user.password }"/><br/>
    真实姓名：<input  type="text"  name="user.relname" value="${user.relname }"/><br/>
    角色：<select  name="user.rid"  >
    					<c:forEach  items="${roles }"  var="r">
    					<c:if test="${user.rid==r.rid }"><option  value="${r.rid }"  selected>${r.rname }</option></c:if>
    					<c:if test="${user.rid!=r.rid }"><option  value="${r.rid }"  >${r.rname }</option></c:if>
    					</c:forEach>
    					</select><br/>
    性别：
   			<c:if test="${user.sex==0}"><input  type="radio"  name="user.sex"    value="0"  checked/>男<input  type="radio"  name="user.sex"    value="1"  />女</c:if><c:if test="${user.sex==1}"><input  type="radio"  name="user.sex"    value="0" />男<input  type="radio"  name="user.sex"    value="1"  checked/>女</c:if><br/>
    部门：<select  name="user.department.did"   >
    					<c:forEach  items="${departs }"  var="d">
    					   <c:if test="${user.department.did==d.did }"><option  selected  value="${d.did }">${d.dname }</option></c:if>
    					   <c:if test="${user.department.did!=d.did }"><option    value="${d.did }">${d.dname }</option></c:if>
    					</c:forEach>
    				</select><br/>
   状态：	
      			<c:if test="${user.state==0 }"><input  type="radio"  name="user.state"  value="0"  checked/>正常<input  type="radio"  name="user.state"  value="1"/>冻结</c:if>
      			<c:if test="${user.state==1 }"><input  type="radio"  name="user.state"  value="0"/>正常<input  type="radio"  name="user.state"  value="1" checked/>冻结</c:if><br/>
   <br/>
    头像：<input type="file"   name="user.src"  value="${user.src }"/>
	<input  type="submit"  value="go"/>
    </form>

     <form action="AddUser.action"  method="post">
    <h2>添加用户：</h2>
    登录名：<input  type="text"  name="user.uname"/><br/>
    密码：<input  type="text"  name="user.password"/><span>初始密码是123456</span><br/>
    真实姓名：<input  type="text"  name="user.relname"/><br/>
    角色：<select  name="user.rid" >
    					<c:forEach  items="${roles }"  var="r">
    					   <option  value="${r.rid }">${r.rname }</option>
    					</c:forEach>
    					</select><br/>
    性别：<input  type="radio"  name="user.sex"    value="0"/>男<input  type="radio"  name="user.sex"   value="1"/>女<br/>
    部门：<select  name="user.department.did" >
    					<c:forEach  items="${departs }"  var="d">
    					   <option  value="${d.did }">${d.dname }</option>
    					</c:forEach>
    				</select><br/>
   状态：	<input  type="radio"  name="user.state"  value="0"/>正常<input  type="radio"  name="user.state"  value="1"/>冻结<br/>
    头像：<input type="file"   name="user.src"/>
	<input  type="submit"  value="go"/>
    </form>
    
    
    
    <table border="1px" >
    <tr><td>车辆显示列表</td></tr>
    <tr><td><a  href="">添加</a></td></tr>
    <c:forEach items="${ cars }"  var="c">
    <tr>
    <td>${c.carPlate }</td>
    <td>${c. brandName}</td>
    <td>${c.number }</td>
    <td>${c.notes }</td>
    <td><a href="QueryCar.action?cid=${c.id }">修改</a></td>
    <td><a href="DelCar.action?cid=${c.id }">删除</a></td>
    </tr>
    </c:forEach>
    </table>
    
    <form action="UpdateCar.action"  method="post">
    车辆修改：<br/>
    车牌号:<input  name="car.carPlate" value="${car. carPlate}"  type="text"/><br/>
    车型:
    	<select  name="car.brand"  >
    	<c:forEach  items="${brands }"  var="cb">
    	<c:if test="${car.brand==cb.bid }"><option  value="${cb.bid }"  selected>${cb.brand }</option></c:if>
    	<c:if test="${car.brand!=cb.bid }"><option  value="${cb.bid }">${cb.brand }</option></c:if>
    	</c:forEach>
    	</select><br/>
    编号:<input name="car.number"  value="${car.number }"  type="text"/><br/>
    备注:<input  name="car.notes" value="${car.notes }"  type="text"/><br/>
    <input  type="hidden"  name="car.id"  value="${car.id }"/><br/>
    <input type="submit"  vluae="go">
    </form>
    
       <form action="AddCar.action"  method="post">
    车辆增加：<br/>
    车牌号:<input  name="car.carPlate"  type="text"/><br/>
   车型:
    	<select  name="car.brand"  >
    	<c:forEach  items="${brands }"  var="cb">
    	<c:if test="${car.brand==cb.bid }"><option  value="${cb.bid }"  selected>${cb.brand }</option></c:if>
    	<c:if test="${car.brand!=cb.bid }"><option  value="${cb.bid }">${cb.brand }</option></c:if>
    	</c:forEach>
    	</select><br/>
    编号:<input name="car.number"   type="text"/><br/>
    备注:<input  name="car.notes"  type="text"/><br/>
    <input type="submit"  vluae="go">
    </form>
  </body>
</html>
